package com.manager.devicemanager.common;

import lombok.Data;


public enum DataSourceNameEnum {
    SYSTEM("system"),
    // 配置IC f 板卡数据源
    ICBOARDATA("icboardata"),
    ICBOARDCONFIG("icboardconfig"),
    // 配置PD 功率板卡数据源
    PDBOARDATA("pdboardata"),
    PDBOARDCONFIG("pdboardconfig");

    private final String dataSourceName;

    DataSourceNameEnum(String dataSourceName) {
        this.dataSourceName = dataSourceName;
    }

    /**
     * 获取数据源名称
     * @return 数据源名称
     */
    public String getDataSourceName() {
        return dataSourceName;
    }

    /**
     * 根据数据源名称查找对应的枚举实例
     * @param dataSourceName 数据源名称
     * @return 对应的枚举实例，若未找到则返回 null
     */
    public static DataSourceNameEnum getByDataSourceName(String dataSourceName) {
        for (DataSourceNameEnum value : DataSourceNameEnum.values()) {
            if (value.dataSourceName.equals(dataSourceName)) {
                return value;
            }
        }
        return null;
    }
}
